﻿@using System.Linq
@using Microsoft.AspNetCore.Http.Extensions
@using Dignite.Abp.AspNetCore.Mvc.UI.Theme.Pure.Themes.Pure.Components.Toolbar.LanguageSwitch
@model LanguageSwitchViewComponentModel
@if (Model.OtherLanguages.Any())
{
    <div class="dropdown">
        <a class="btn" href="#" id="Menu_LanguageSwitch" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="@Model.CurrentLanguage.DisplayName">
            <i class="fa fa-language" aria-hidden="true"></i> <small class="d-none d-sm-none d-md-none d-lg-inline">@Model.CurrentLanguage.DisplayName</small>
        </a>
        <div class="dropdown-menu dropdown-menu-lg-end border-0" aria-labelledby="Menu_LanguageSwitch">
            @foreach (var language in Model.OtherLanguages)
            {
                <a class="dropdown-item" href="~/Abp/Languages/Switch?culture=@(language.CultureName)&uiCulture=@(language.UiCultureName)&returnUrl=@(System.Net.WebUtility.UrlEncode(Context.Request.GetEncodedPathAndQuery()))">
                    @language.DisplayName
                </a>
            }
        </div>
    </div>
}